package org.laizili.solution.nowcodertop101.dp;

/**
 * <a href="">BM63. 跳台阶</a>
 * <p>
 * tags: 动态规划; 记忆化搜索;
 * </p>
 */
public class BM63 {
    private static class Solution {
        private static final int[] dp = new int[50];

        static {
            dp[1] = 1;
            dp[2] = 2;
        }

        public int jumpFloor(int target) {
            for (int i = 3; i <= target; i++) {
                dp[i] = dp[i - 1] + dp[i - 2];
            }
            return dp[target];
        }
    }

    public static void main(String[] args) {
        System.out.println(new Solution().jumpFloor(3));
    }
}
